﻿using Microsoft.EntityFrameworkCore;
using PhotinoNote.Entities;
using System;

namespace PhotinoNote
{
    public class ApplicationDbContext : DbContext
    {
        public string DbPath { get; }
        public ApplicationDbContext()
        {
            DbPath = System.IO.Path.Join(Environment.CurrentDirectory, "db_photino_note.db");
        }


        // 实体表
        public DbSet<Notebook> Notebooks { get; set; }
        public DbSet<Note> Notes { get; set; }


        protected override void OnConfiguring(DbContextOptionsBuilder options)
        => options.UseSqlite($"Data Source={DbPath}");

    }
}
